import * as service from './core';

module.exports = router => {
    router.post('/', ctx => {
        const {queTempId, status, questions} = ctx.request.body;
        return service.saveAnswers(ctx.request.user, queTempId, questions, status)
            .then(ctx.done)
            .catch(ctx.fail);
    });
    router.get('/:queId', ctx => {
        return service.getAnswers(ctx.params.queId)
            .then(ctx.done)
            .catch(ctx.fail);
    });
};
